package com.example.waimai.ui.notifications;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.example.waimai.context.UserInfoContext;
import com.example.waimai.pojo.User;

public class NotificationsViewModel extends ViewModel {

    private MutableLiveData<User> userInfo;

    public MutableLiveData<User> getUserInfo(){
        if(userInfo == null){
            userInfo = new MutableLiveData<>();
            loadUserInfo();
        }

        return userInfo;
    }

    private void loadUserInfo(){
        // 初始化 UserInfo
        userInfo.setValue(UserInfoContext.mUser);
    }

    @Override
    protected void onCleared() {
        super.onCleared();
    }


}